/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#ifndef __PQ_GameProject_H__
#define __PQ_GameProject_H__

#include "EnginePrerequisites.h"

#include "GPKArchiveManager.h"

namespace PQEngine
{
	/*Represent a Gdk3d game project
	*/
	class GameProject
	{
	public:
		typedef std::map<std::string,GameProject*> GProjectMap;
		static const std::string PERSIS_FILE_NAME;
	protected:
		GameProject(std::string path);
		
	public:
		static GameProject* get(std::string path);

		GPKArchive* createAssetArchive(std::string name);
		
		inline int getAssetArchiveCount()
		{
			return GNgGPKArchiveManager.getNumArchive();
		}

		inline std::string getAssetArchiveName(int index)
		{
			return GNgGPKArchiveManager.getArchiveName(index);
		}

		/*Return file count in specified asset archive
		*/
		inline int getAssetArchiveFileCount(int index)
		{

			return GNgGPKArchiveManager.getNumFile(index);
		}

		/*Return file name in specified asset archive with specified index
		*/
		inline std::string getAssetArchiveFileName(int archiveIndex,int fileIndex)
		{
			return GNgGPKArchiveManager.getFileName(archiveIndex,fileIndex);
		}

		/*Add local file to index-th .gpk asset archive
		*/
		inline bool addAssetArchiveFile(int index,std::string fileName)
		{
			return GNgGPKArchiveManager.addArchiveFile(index,fileName);
		}

	private:
		void loadAssetsArchive();
		void persist();
	private:
		static GProjectMap _map;
		std::string _path;//project root path
		
	};
}

#endif
